set LIBP $env(AIOSS_HOME)/lib
load $LIBP/libmysqltcl3.05.so

set dbConnection ""

#if { [::mysql::state  $dbConnection] != 2 } {
	set dbConnection [::mysql::connect -host localhost -user freepbx -db asterisk -password freepbx123]
	puts "Connected mysql..."
#}

proc  connectDb {} {
	global dbConnection 
	if { [catch {::mysql::ping $dbConnection}] } {
	puts "db connect again"
	set dbConnection [::mysql::connect -host localhost -user freepbx -db asterisk -password freepbx123]
	} else {
		puts "dbconection ok"
	}

}
